package com.koron.sinoprobe.web.purchase.service;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.koron.bean.query.PageQuery;
import com.koron.sinoprobe.web.purchase.bean.po.SpPurchaseGoods;
import org.koron.ebs.mybatis.SessionFactory;

import java.util.List;

/**
 * 采购验收-物品清单(SpPurchaseGoods)表服务接口
 *
 * @author jzp
 * @since 2021-12-29 10:20:04
 */
public interface SpPurchaseGoodsService {

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    SpPurchaseGoods getById(SessionFactory factory, String id);

    /**
     * 查询所有数据
     *
     * @param spPurchaseGoods 查询条件对象
     * @return 列表结果集
     */
    List<SpPurchaseGoods> list(SessionFactory factory, SpPurchaseGoods spPurchaseGoods);

    List<SpPurchaseGoods> listByAcceptId(SessionFactory factory, String id);

    /**
     * 分页查询
     *
     * @param spPurchaseGoods 分页条件
     * @return 对象列表
     */
    default PageInfo<SpPurchaseGoods> page(SessionFactory factory, PageQuery pageQuery, SpPurchaseGoods spPurchaseGoods) {
        PageHelper.startPage(pageQuery.getPage(), pageQuery.getPageSize(), pageQuery.getOrderBy());
        List<SpPurchaseGoods> spPurchaseGoodsList = list(factory, spPurchaseGoods);
        return new PageInfo<>(spPurchaseGoodsList);
    }

    /**
     * 新增数据
     *
     * @param spPurchaseGoods 实例对象
     * @return 是否成功
     */
    boolean save(SessionFactory factory, SpPurchaseGoods spPurchaseGoods);

    boolean saveBatch(SessionFactory factory, List<SpPurchaseGoods> lists);

    /**
     * 修改数据
     *
     * @param spPurchaseGoods 实例对象
     * @return 是否成功
     */
    boolean update(SessionFactory factory, SpPurchaseGoods spPurchaseGoods);

    boolean deleteBatchIds(SessionFactory factory, List<String> ids);

    boolean removeByAcceptId(SessionFactory factory, String acceptId);
}
